package com.kun.remote.fallback;

import com.kun.entity.SysRole;
import com.kun.remote.RemoteRoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.ArrayList;
import java.util.List;

/**
 * @author kun.li
 */
@Slf4j
public class RemoteRoleServiceFallBackFactory implements FallbackFactory<RemoteRoleService> {
    @Override
    public RemoteRoleService create(Throwable cause) {
        log.error(cause.getMessage());
        return new RemoteRoleService() {

            @Override
            public List<SysRole> getRoleList(String userId) {
                return new ArrayList<>();
            }
        };
    }
}
